import {
	defineStore
} from 'pinia'
import {
	SystemApi
} from '../../api/system'
import {
	keyTeam
} from '../../utils/handleDeptData'
import _ from 'lodash'
export const useSyStemStore = defineStore('useSyStemStore', {
	state: () => ({

		deptTeamUserList: null,
		dicList: null,
		deptList: null,
		userList: null,
		teamList: null,
		teamUserList: null,
		deviceInfo: null,
		viewHeight: 0,
		version: {
			dept: null,
			dict: null,
			team: null,
			user: null,
		}
	}),

	getters: {


	},

	actions: {

		setVersion(version) {
			this.version = version
		},
		async getDeptTeamUserList(data) {
			const res = await SystemApi.getDeptTeamUser()
			this.deptTeamUserList = res.data
		},
		async getDicList() {
			const res = await SystemApi.getDicList()
			this.dicList = res.data
		},
		async getDeptList() {
			const res = await SystemApi.getDeptList()
			this.deptList = res.data
		},
		async getUserList() {
			const res = await SystemApi.getUserList()
			this.userList = res.data
		},
		async getTeamList() {
			const res = await SystemApi.getTeamList()
			this.teamList = res.data
		},
		async getTeamUserList() {
			const res = await SystemApi.getTeamUserList()
			this.teamUserList = res.data
		},
		setDeviceInfo(data) {
			this.deviceInfo = data
		},
		setViewHeight(data) {
			this.viewHeight = data
		}

	},
	persist: true,
})